<template>
    <div class="account-address">
        <m-sheet-group title="添加地址">
            <i class="iconfont" slot="icon" @click="goto('/address/add')">&#xe81a;</i>
            <m-cell title="暂未添加地址" v-if="addressList.length === 0"></m-cell>
            <m-address-cell
                    :key="k"
                    :info="i"
                    v-for="(i,k) in addressList"
            ></m-address-cell>
        </m-sheet-group>
    </div>
</template>

<script>
    export default {
        data() {
            return {
                addressList: []
            }
        },
        methods: {
            getUserAddressList() {
                const self = this;
                this.$http.getUserAddressList().then(res => {
                    if (res.success === true) {
                        self.addressList = res.data;
                    }
                }, error => {
                });
            }
        },
        created() {
            this.getUserAddressList();
        }
    }
</script>

<style lang="less">
    .account-address {
        .account-address-pop-picker {
            display: flex;
            flex-direction: column;
            .pop-picker-header {
                display: flex;
                flex-basis: 54px;
                justify-content: space-between;
                .header-cancel {
                    flex-grow: 0;
                }
                .header-comfirm {
                    flex-grow: 0;
                }
            }
        }
    }
</style>


